]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
popupMenu: dismiss the menu on touch events
authorCarlos Garnacho <carlosg@gnome.org>
Tue, 22 Jul 2014 10:27:05 +0000 (12:27 +0200)
committerCarlos Garnacho <carlosg@gnome.org>
Thu, 24 Jul 2014 16:15:02 +0000 (18:15 +0200)
No sequence checks are done, just any touch outside will dismiss the popup.

https://bugzilla.gnome.org/show_bug.cgi?id=733633

js/ui/popupMenu.js

index 36d7f845e01cc2b7d08ac9cc63d1663e6c29d44c..34986f7332d190d83e5d9f2a0a614996b2ec7e37 100644 (file)
@@ -106,6 +106,7 @@ const PopupBaseMenuItem = new Lang.Class({
 
         if (this._activatable) {
             this.actor.connect('button-release-event', Lang.bind(this, this._onButtonReleaseEvent));
+            this.actor.connect('touch-event', Lang.bind(this, this._onTouchEvent));
             this.actor.connect('key-press-event', Lang.bind(this, this._onKeyPressEvent));
         }
         if (params.reactive && params.hover)
@@ -132,6 +133,14 @@ const PopupBaseMenuItem = new Lang.Class({
         return Clutter.EVENT_STOP;
     },
 
+    _onTouchEvent: function (actor, event) {
+        if (event.type() == Clutter.EventType.TOUCH_END) {
+            this.activate(event);
+            return Clutter.EVENT_STOP;
+        }
+        return Clutter.EVENT_PROPAGATE;
+    },
+
     _onKeyPressEvent: function (actor, event) {
         let symbol = event.get_key_symbol();